#include<bits/stdc++.h>
using namespace std;

int a[10000];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int sum = 0, cnt = 0, k = i / 2;
		for (int j = 1; j <= k; j++) {
			if (i % j == 0) {
				sum = sum + j;
				a[++cnt] = j;
			}
		}
		if (sum == i) {
			cout << i << " its factors are ";
//			printf("%d its factors are ", i);
			for (int l = 1; l <= cnt; l++)
				cout << a[l] << " ";
			cout << endl;
		}
	}
	return 0;
}
